/**
 * @author mr.doob / http://mrdoob.com/
 * @author alteredq / http://alteredqualia.com/
 * @author szimek / https://github.com/szimek/
 */

GLE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type ) {

	this.id = GLE.TextureCount ++;

	this.image = image;

	this.mapping = mapping !== undefined ? mapping : new GLE.UVMapping();

	this.wrapS = wrapS !== undefined ? wrapS : GLE.ClampToEdgeWrapping;
	this.wrapT = wrapT !== undefined ? wrapT : GLE.ClampToEdgeWrapping;

	this.magFilter = magFilter !== undefined ? magFilter : GLE.LinearFilter;
	this.minFilter = minFilter !== undefined ? minFilter : GLE.LinearMipMapLinearFilter;

	this.format = format !== undefined ? format : GLE.RGBAFormat;
	this.type = type !== undefined ? type : GLE.UnsignedByteType;

	this.offset = new GLE.Vector2( 0, 0 );
	this.repeat = new GLE.Vector2( 1, 1 );

	this.generateMipmaps = true;

	this.needsUpdate = false;
	this.onUpdate = null;

};

GLE.Texture.prototype = {

	constructor: GLE.Texture,

	clone: function () {

		var clonedTexture = new GLE.Texture( this.image, this.mapping, this.wrapS, this.wrapT, this.magFilter, this.minFilter, this.format, this.type );

		clonedTexture.offset.copy( this.offset );
		clonedTexture.repeat.copy( this.repeat );

		return clonedTexture;

	}

};

GLE.TextureCount = 0;

GLE.MultiplyOperation = 0;
GLE.MixOperation = 1;

// Mapping modes

GLE.CubeReflectionMapping = function () {};
GLE.CubeRefractionMapping = function () {};

GLE.LatitudeReflectionMapping = function () {};
GLE.LatitudeRefractionMapping = function () {};

GLE.SphericalReflectionMapping = function () {};
GLE.SphericalRefractionMapping = function () {};

GLE.UVMapping = function () {};

// Wrapping modes

GLE.RepeatWrapping = 0;
GLE.ClampToEdgeWrapping = 1;
GLE.MirroredRepeatWrapping = 2;

// Filters

GLE.NearestFilter = 3;
GLE.NearestMipMapNearestFilter = 4;
GLE.NearestMipMapLinearFilter = 5;
GLE.LinearFilter = 6;
GLE.LinearMipMapNearestFilter = 7;
GLE.LinearMipMapLinearFilter = 8;

// Types

GLE.ByteType = 9;
GLE.UnsignedByteType = 10;
GLE.ShortType = 11;
GLE.UnsignedShortType = 12;
GLE.IntType = 13;
GLE.UnsignedIntType = 14;
GLE.FloatType = 15;

// Formats

GLE.AlphaFormat = 16;
GLE.RGBFormat = 17;
GLE.RGBAFormat = 18;
GLE.LuminanceFormat = 19;
GLE.LuminanceAlphaFormat = 20;
